import random


def game():
    player = int(input('你的出拳是(石头0，剪刀1，布2):'))
    GPT = random.randint(0, 2)
    if player == GPT:
        print(f'机器人出拳结果为{GPT},平局')
    elif ((player == 0) and (GPT == 1)) or ((player == 1) and (GPT == 2)) or ((player == 2) and (GPT == 0)):
        print(f'机器人出拳结果为{GPT},玩家胜出')
    else:
        print(f'机器人出拳结果为{GPT},机器人赢')


# game()

dic = {0: "剪刀", 1: "石头", 2: "布"}


# def new_game():
#     player = int(input('你的出拳是(石头0，剪刀1，布2):'))
#     GPT = random.randint(0, 2)
#     if player == GPT:
#         print(f'玩家出【{dic[player]}】、机器人出【{dic[GPT]}】 => 平局')
#     elif ((player == 0) and (GPT == 1)) or ((player == 1) and (GPT == 2)) or ((player == 2) and (GPT == 0)):
#         print(f'玩家出【{dic[player]}】、机器人出【{dic[GPT]}】 => 玩家胜出')
#     else:
#         print(f'玩家出【{dic[player]}】、机器人出【{dic[GPT]}】 => 机器人赢')

def new_game(player, GPT):
    print(f'Test player=> {player},GPT => {GPT},差=> {(player - GPT)}')
    if player == GPT:
        print(f'玩家出【{dic[player]}】、机器人出【{dic[GPT]}】 => 平局')
    elif (player - GPT) == 1 or (player - GPT) == -(len(dic) - 1):
        print(f'玩家出【{dic[player]}】、机器人出【{dic[GPT]}】 => 玩家胜出')
    else:
        print(f'玩家出【{dic[player]}】、机器人出【{dic[GPT]}】 => 机器人赢')

    print('-' * 50)


if __name__ == "__main__":
    # 先注释掉，用下面代码测试程序，程序没问题了再放开来
    # player = int(input('你的出拳是(石头0，剪刀1，布2):'))
    # GPT = random.randint(0, 2)
    # new_game(player, GPT)

    # 下面测试程序，跳过 平局
    for play in range(0, len(dic)):
        for robot in range(0, len(dic)):
            new_game(play, robot)
